// SLABHIDDeviceWrapper_Cpp.cpp : Defines the exported functions for the DLL application.
//

#include "stdafx.h"


extern "C" 
{
	 __declspec(dllexport) int CHIDDeviceWrapperGetNumHidDevices(int vid, int pid)
	{
		return GetNumHidDevices(vid,pid);
	}

	__declspec(dllexport) CHIDDevice* CHIDDeviceWrapperCtor()
	{
		return new CHIDDevice();
	}

	__declspec(dllexport) void CHIDDeviceWrapperDispose(CHIDDevice* ptr)
	{
		delete ptr;
	}

	__declspec(dllexport) int CHIDDeviceWrapperOpen(CHIDDevice* ptr, int deviceIndex, int vid, int pid, int numInputBuffers)
	{
		return ptr->Open(deviceIndex,vid,pid,numInputBuffers);
	}

	__declspec(dllexport) bool CHIDDeviceWrapperIsOpened(CHIDDevice* ptr)
	{
		return ptr->IsOpened();
	}

	__declspec(dllexport) int CHIDDeviceWrapperClose(CHIDDevice* ptr)
	{
		return ptr->Close();
	}

	__declspec(dllexport) int CHIDDeviceWrapperGetString(CHIDDevice* ptr, int hidStringType, LPSTR deviceString, int deviceStringLength)
	{
		return ptr->GetString(hidStringType,deviceString,deviceStringLength);
	}

	__declspec(dllexport) int CHIDDeviceWrapperSetFeatureReport_Control(CHIDDevice* ptr,BYTE* buffer, int bufferSize)
	{
		return ptr->SetFeatureReport_Control(buffer,bufferSize);
	}

	__declspec(dllexport) int CHIDDeviceWrapperGetFeatureReport_Control(CHIDDevice* ptr,BYTE* buffer, int bufferSize)
	{
		return ptr->GetFeatureReport_Control(buffer,bufferSize);
	}

	__declspec(dllexport) int CHIDDeviceWrapperSetOutputReport_Interrupt(CHIDDevice* ptr,BYTE* buffer, int bufferSize)
	{
		return ptr->SetOutputReport_Interrupt(buffer,bufferSize);
	}

	__declspec(dllexport) int CHIDDeviceWrapperGetInputReport_Interrupt(CHIDDevice* ptr,BYTE* buffer, int bufferSize, int numReports, unsigned long* bytesReturned)
	{
		return ptr->GetInputReport_Interrupt(buffer,bufferSize,numReports,bytesReturned);
	}

	__declspec(dllexport) int CHIDDeviceWrapperSetOutputReport_Control(CHIDDevice* ptr,BYTE* buffer, int bufferSize)
	{
		return ptr->SetOutputReport_Control(buffer,bufferSize);
	}

	__declspec(dllexport) int CHIDDeviceWrapperGetInputReport_Control(CHIDDevice* ptr,BYTE* buffer, int bufferSize)
	{
		return ptr->GetInputReport_Control(buffer,bufferSize);
	}

	__declspec(dllexport) int  CHIDDeviceWrapperGetInputReportBufferLength(CHIDDevice* ptr)
	{
		return ptr->GetInputReportBufferLength();
	}

	__declspec(dllexport) int  CHIDDeviceWrapperGetOutputReportBufferLength(CHIDDevice* ptr)
	{
		return ptr->GetOutputReportBufferLength();
	}

	__declspec(dllexport) int  CHIDDeviceWrapperGetFeatureReportBufferLength(CHIDDevice* ptr)
	{
		return ptr->GetFeatureReportBufferLength();
	}

	__declspec(dllexport) int  CHIDDeviceWrapperGetMaxReportRequest(CHIDDevice* ptr)
	{
		return ptr->GetMaxReportRequest();
	}

	__declspec(dllexport) bool CHIDDeviceWrapperFlushBuffers(CHIDDevice* ptr)
	{
		return ptr->FlushBuffers();
	}

	__declspec(dllexport) void CHIDDeviceWrapperGetTimeouts(CHIDDevice* ptr,unsigned int* getReportTimeout, unsigned int* setReportTimeout)
	{
		ptr->GetTimeouts(getReportTimeout,setReportTimeout);
	}

	__declspec(dllexport) void CHIDDeviceWrapperSetTimeouts(CHIDDevice* ptr,unsigned int getReportTimeout, unsigned int setReportTimeout)
	{
		ptr->SetTimeouts(getReportTimeout,setReportTimeout);
	}
}